<?php

namespace App\Http\Controllers;

use App\Models\Project;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class FaceController extends Controller
{
    // public function face(Request $request)
    // {
    //     if(!$request->photo){
    //         return response()->json(['code' => 404, 'message' => '请重新进行人脸验证', 'data'=>null]);
    //     }

    //     //根据项目编号查询项目
    //     $team = Project::find($request->team_id);
    //     if(!$team){
    //         return response()->json(['code' => 404, 'message' => '请选择正确的班组', 'data'=>null]);
    //     }

    //     $user = Auth::user();
    //     $POSTONLY = LaborAttendance::POSTONLY;
    //     $input = $request->only($POSTONLY);
    //     $input['project_id'] = $request->project_id;
    //     $input['labor_id'] = $user->id;
    //     $TencentFaceService = new TencentFaceService();
    //     if(strpos($user->photo, 'https') === false){
    //         $user->photo = env('UPLOAD_APP_PREFIX').$user->photo;
    //     }
    //     $FaceSimilarity = $TencentFaceService->FaceSimilarity($request->photo,$user->photo);
    //     $data = '';
    //     if($FaceSimilarity->Score > 70){
    //         $data = $this->LaborAttendanceService->attendance($input);
    //     }else{
    //         return response()->json(['code' => 500, 'message' => '非本人，无法打卡']);
    //     }
    //     return response()->json(['code' => 200, 'message' => '打卡成功', 'FaceSimilarity'=>$FaceSimilarity, 'data'=>$data]);
    // }
}
